import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { PurchaseOrderLogisticsInfoVO, PurchaseOrderLogisticsInfoForm, PurchaseOrderLogisticsInfoQuery } from '@/api/lingxing/purchaseOrderLogisticsInfo/types';

/**
 * 查询采购单物流信息列表
 * @param query
 * @returns {*}
 */

export const listPurchaseOrderLogisticsInfo = (query?: PurchaseOrderLogisticsInfoQuery): AxiosPromise<PurchaseOrderLogisticsInfoVO[]> => {
  return request({
    url: '/lingxing/purchaseOrderLogisticsInfo/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询采购单物流信息详细
 * @param id
 */
export const getPurchaseOrderLogisticsInfo = (id: string | number): AxiosPromise<PurchaseOrderLogisticsInfoVO> => {
  return request({
    url: '/lingxing/purchaseOrderLogisticsInfo/' + id,
    method: 'get'
  });
};

/**
 * 新增采购单物流信息
 * @param data
 */
export const addPurchaseOrderLogisticsInfo = (data: PurchaseOrderLogisticsInfoForm) => {
  return request({
    url: '/lingxing/purchaseOrderLogisticsInfo',
    method: 'post',
    data: data
  });
};

/**
 * 修改采购单物流信息
 * @param data
 */
export const updatePurchaseOrderLogisticsInfo = (data: PurchaseOrderLogisticsInfoForm) => {
  return request({
    url: '/lingxing/purchaseOrderLogisticsInfo',
    method: 'put',
    data: data
  });
};

/**
 * 删除采购单物流信息
 * @param id
 */
export const delPurchaseOrderLogisticsInfo = (id: string | number | Array<string | number>) => {
  return request({
    url: '/lingxing/purchaseOrderLogisticsInfo/' + id,
    method: 'delete'
  });
};
